package com.serviceprovider.business.module.user.model.interfaces;

//~--- non-JDK imports --------------------------------------------------------

import com.serviceprovider.business.module.user.model.forms.EditUserForm;
import com.serviceprovider.business.module.user.model.forms.ViewUserForm;

import org.springframework.validation.BindingResult;
import org.springframework.web.servlet.ModelAndView;

//~--- JDK imports ------------------------------------------------------------

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @Leonardo A. Auer
 * @since 04/11/2011
 */

/**
 * Implement this class to catch users request.
 * UserController must implement this class.
 * Classes instantiated with UserManagerFactory must implement this class.
 * This class provides generic methods to manage User functions.
 */
public interface IUserManager {

    /**
     * Sets necessary objects in ModelAndView instance
     * to display in the view.
     * Retrieves a list of users to display in the view.
     * @return ModelAndView
     */

//  public ModelAndView viewUsers(HttpServletRequest request, HttpSession session, BindingResult result);

    /**
     * Activates or deletes users from a viewUserForm's property list.
     *
     * @return ModelAndView
     */
    public ModelAndView updateUserList(HttpServletRequest request, HttpSession session, ViewUserForm viewUserForm,
                                       BindingResult result);

    /**
     * Search users according to criteria and viewUserFormValues.
     * Supports pagination.
     *
     * @param request
     * @param session
     * @param viewUserForm
     * @param result
     * @return
     */
    public ModelAndView searchUsersPost(HttpServletRequest request, HttpSession session, ViewUserForm viewUserForm,
            BindingResult result);

    /**
     * Sets necessary objects in ModelAndView instance
     * to display in the view.
     *
     * @return ModelAndView
     */
    public ModelAndView enterCreateUser();

    /**
     * Creates a new User.
     *
     * @param editUserForm
     * @param result
     * @return ModelAndView
     */
    public ModelAndView createUser(EditUserForm editUserForm, BindingResult result);

    /**
     * Sets necessary objects in ModelAndView instance
     * to display in the view.
     *
     * @param userId
     * @param saveSuccess
     * @return ModelAndView
     */
    public ModelAndView viewUserDetails(int userId, Boolean saveSuccess);

    /**
     * Sets necessary objects in ModelAndView instance
     * to display in the view.
     *
     * @param request
     * @return ModelAndView
     */
    public ModelAndView editUserDetails(HttpServletRequest request);

    /**
     * Updates and user.
     *
     * @param editUserForm
     * @param result
     * @return ModelAndView
     */
    public ModelAndView updateUserDetails(EditUserForm editUserForm, BindingResult result);

    /**
     * Sets necessary objects in ModelAndView instance
     * to display in the view.
     * Displays in the view the user connected details.
     *
     * @return ModelAndView
     */
    public ModelAndView viewMyUserDetails();

    /**
     * Updates the user connected details.
     *
     * @param request
     * @return ModelAndView
     */
    public ModelAndView editMyUserDetails(HttpServletRequest request);
}



